package com.start.common;

import com.start.common.registers.StartRegisterFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@ConditionalOnProperty(prefix = "start.register", value = "enabled", havingValue = "true")
public class StartLineRunner implements CommandLineRunner {

    @Autowired
    private StartRegisterFactory registerFactory;

    @Override
    public void run(String... args) throws Exception {
        log.info("系统启动完成,开始注册其他插件");
        registerFactory.register();
        log.info("插件注册完成！");
    }
}
